package com.example.androidcomplete0102.ch17;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.example.androidcomplete0102.R;

public class Ch17_Main extends ListActivity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		getWindow().requestFeature(Window.FEATURE_NO_TITLE);
		//getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
		
		ArrayAdapter adapter = ArrayAdapter.createFromResource(this, R.array.chapter17, android.R.layout.simple_list_item_1);
		setListAdapter(adapter);
	}
	
	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		super.onListItemClick(l, v, position, id);
		
		
		Intent intent = null;
		switch(position){
		case 0: intent = new Intent(this, CommActiviy.class);
		break;
		case 1: intent = new Intent(this, CallOther.class);
		break;
		case 2: intent = new Intent(this, ActParent.class);
		break;
		case 3: intent = new Intent(this, SaveState.class);
		break;
		case 4: intent = new Intent(this, SaveCurve.class);
		break;
		case 5: intent = new Intent(this, ApplicationTest.class);
		break;
		}	
		startActivity(intent);
	}
}
